<include file="Index/header" />
<body class="body">
<include file="Index/picture" />
	<div class="list_nav">
    	<span>E-MBA云社群邀你进入社群时代</span><img src="__PUBLIC__/Home/images/img.png"/>
    </div>
    <center id="loading">&nbsp;<br /><img width="10%" src="__PUBLIC__/Home/images/loading.gif"></center>
    <div class="list_box" id="community_list" style="min-height:100%;">
		
    </div>
</body>
</html>
<script>
	$(function($) {
		ajaxCommunityList();
	});
	function joinCommunity(community_id,is_join){
		if( is_join != '1' && !confirm("活动期间只允许加入一个区域社群，请慎重选择哦！")){
			 return false;
		}
		var host = 'http://'+window.location.host;
		var user_id = "{$Think.session.user_id}";
		user_id = parseInt(user_id);
		if(user_id > 0){
			//window.location.href= "/Index/joinCommunity?community_id="+community_id;
			var post_data={'community_id':community_id};
	        $.ajax({
	            type: "POST",
	            url:"/Index/joinCommunity",
	            data: post_data,
	            success: function(data){
	                if(data.status == '0'){
	                	if(data.data == 1){
	                		//alert("您已加入过该社群");
	                		window.location.href= host+"/Index/myInvitation?community_id="+community_id+"&invite_id={$user_id}";
	                	}else if(data.data == 2){
	                		window.location.href= host+"/Index/only";
	                	}else{
	                		alert('恭喜你，社群加入成功！');
	                		window.location.href= host+"/Index/getInvitation?community_id="+community_id+"&community_name="+data.info;
	                	}
	                    //alert(data.info);
	                }else{
	                    alert(data.info);
	                    return false;
	                }
	
	            },
	            dataType:"json"
	        });
			
		}else{
			window.location.href= host+"/Index/login?community_id="+community_id;
			return false;
		}
	}
	function ajaxCommunityList(){
		var json_data = {
		};
		$("#community_list").load("/Index/ajaxCommunityList?random="+Math.random(),{},function(){
			$("#loading").hide();
		});
	}
</script>